package itheima.com.Reader;

import java.io.*;

public class FileCopy {

    public static void main(String[] args) throws FileNotFoundException {
//        完成文件拷贝，将
//        思路分析：
//        先读
//        后写
        String filePath = "D:\\一条小团团\\WeChat_20250717164848.mp4";
        String writerPath = "D:\\一条小团团\\a\\b\\c\\01.mp4";
//        ObjectInputStream ois = null;
//        ObjectOutputStream oos = null;
        FileInputStream fis = null;
        FileOutputStream fos = null;

        byte[] bytes = new byte[1024];
        int bufun = 0;
        try {
//            ois = new ObjectInputStream(new FileInputStream(filePath));
//            oos = new ObjectOutputStream(new FileOutputStream(writerPath));
            fis = new FileInputStream(filePath);
            fos = new FileOutputStream(writerPath);


            while ((bufun = fis.read(bytes)) != -1) {
                fos.write(bytes, 0, bufun);
                System.out.println("拷贝成功~~~~~");
            }

        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                if (fis != null) {
                    fis.close();
                }
                if (fos != null) {
                    fos.close();
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

    }

}
